<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.&nbsp;Getting Started (command line)</title><link href="../skin/css/doc.css" rel="stylesheet" type="text/css"><meta content="DocBook XSL Stylesheets V1.66.1" name="generator"><link rel="start" href="userguide.html" title="EMMA User Guide"><link rel="up" href="userguide.html" title="EMMA User Guide"><link rel="prev" href="userguide.html" title="EMMA User Guide"><link rel="next" href="ar01s02s02.html" title="2.2.&nbsp;emmarun: instrumenting Java classes
on-the-fly"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">2.&nbsp;Getting Started (<span class="emphasis"><em>command line</em></span>)</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="userguide.html"><img src="../images/prev.gif" alt="Prev"></a>&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="ar01s02s02.html"><img src="../images/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="introCMDLINE"></a>2.&nbsp;Getting Started (<span class="emphasis"><em>command line</em></span>)</h2></div></div></div><p>This section introduces EMMA command line tools. It starts with an
example of how to run an application so that coverage instrumentation is
performed on-the-fly, as the classes are loaded by the JVM, and then repeats
the same process by breaking it into distinct
instrumentation/execution/reporting steps.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Sample source code</h3><p>The source code located in <tt class="filename">examples/src</tt>
directory of EMMA distribution is used for all examples in this
tutorial.</p></div><p><a href="ar01s03.html" title="3.&nbsp;Getting Started (ANT)">Section&nbsp;3, &ldquo;Getting Started (<span class="emphasis"><em>ANT</em></span>)&rdquo;</a> works with the same sample application
through Apache ANT build tool. All of EMMA's command-line functionality is
available via EMMA's ANT tasks and there is some duplication of content
between this and the following sections, so you might want to skip ahead if
you expect to obtain coverage through ANT builds exclusively. You should
also skip ahead if you've already gone through "Getting Started" steps on
EMMA's web site.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="N10052"></a>2.1.&nbsp;Adding EMMA command line tools to your classpath</h3></div></div></div><p>The recommended way to install EMMA command.line tools is to
make emma.jar an extension library for your Java Runtime Environment (JRE).
This is accomplished simply by copying emma.jar to
<tt class="filename">&lt;your&nbsp;jre&nbsp;dir&gt;/lib/ext/</tt> directory for
whichever JRE you use from command line.</p><p>EMMA distribution neither depends on any external Java libraries
nor includes them inside EMMA jars. This means installing EMMA as a JRE
extension will not pollute your classpath with unknown versions of Java
libraries that you might be using elsewhere in your work. This also has the
advantage of setting up <tt class="filename">emma.jar</tt> as a trusted Java
library, which is useful for collecting coverage in security sensitive
configurations.	</p><p>Still, if you are wary of adding a third-party library as a
standard JRE extension, just make sure that all your EMMA command line
invocations add <tt class="filename">emma.jar</tt> to the JVM classpath:</p><pre class="screen">
&gt;java -cp .../lib/emma.jar &lt;emma or emmarun command&gt;</pre></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="userguide.html"><img src="../images/prev.gif" alt="Prev"></a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="userguide.html"><img src="../images/up.gif" alt="Up"></a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="ar01s02s02.html"><img src="../images/next.gif" alt="Next"></a></td></tr><tr><td valign="top" align="left" width="40%">EMMA User Guide&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="userguide.html"><img src="../images/home.gif" alt="Home"></a></td><td valign="top" align="right" width="40%">&nbsp;2.2.&nbsp;<span><b class="command">emmarun</b></span>: instrumenting Java classes
on-the-fly</td></tr></table></div></body></html>